package aircraft;

import java.awt.image.BufferedImage;

/**
 * 大敌机
 */
public class BigAirplane extends FlyingObject implements EnemyScore {
    private int speed;

    public BigAirplane() {
        super(66, 89);
        speed = 2;
    }

    public void step() {
        y += speed;
    }

    int index = 1;

    @Override
    public BufferedImage getImage() {
        if (state == LIVE) {
            return Images.bairs[0];
        } else if (state == DEAD) {
            BufferedImage img = Images.bairs[index++];
            if (index == Images.bairs.length) {
                state = REMOVE;
            }
            return img;
        }
        return null;
    }

    @Override
    public int getScore() {
        return 3;
    }

    public AirBullet airShoot() {
        int xStep = width / 2;
        int yStep = height / 2;
        return new AirBullet(x + xStep, y + yStep);
    }

}
